#!/usr/bin/env python
# -*- coding: utf-8 -*-


from PyQt5.QtSerialPort import QSerialPort, QSerialPortInfo

com_list = QSerialPortInfo.availablePorts()
com = QSerialPort()


class TestClass(object):
    # 类变量
    val1 = 100
    def __init__(self):
        # 成员变量
        self.val2 = 200

    def fcn(self, val=400):
        val3 = 300
        self.val4 = val
        self.val5 = 500



if __name__ == '__main__':
    # import sys
    # import cgitb

    # com_list = QSerialPortInfo.availablePorts()
    # com = QSerialPort()

    inst = TestClass()
 
    print(TestClass.val1)  # 100
    print(inst.val1)   # 100
    print(inst.val2)    # 200
    #print(inst.val3)  # AttributeError: 'TestClass' object has no attribute 'val3'
    print(inst.val4)    # AttributeError: 'TestClass' object has no attribute 'val4'
    print(inst.val5)  # AttributeError: 'TestClass' object has no attribute 'val5'